﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="view-suppliers.aspx.cs" Inherits="Eisk.Web.view_suppliers" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <script type="text/javascript">
        function SelectAll(frmId, id) {
            debugger;
            var frm = document.getElementById(frmId);
            for (i = 1; i < frm.rows.length; i++) {
                var checkbox = frm.rows[i].cells[5].childNodes[1];
                if (checkbox != null)
                    checkbox.checked = document.getElementById(id).checked;
            }
        };
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <%--<asp:GridView ID="GridViewSuppliersList" runat="server" CssClass="GridView">
    </asp:GridView>
    <hr />--%>
    <asp:ScriptManager ID="scriptManager" runat="server" />
    <asp:UpdatePanel ID="upd" runat="server">
        <ContentTemplate>
            <div class="clearfix align-right">
                <asp:LinkButton SkinID="LinkButton" runat="server" ID="lbtAddSupplier" Text="Add New Supplier"
                    OnClick="ButtonAddNewSupplier_Click" />
                <asp:LinkButton SkinID="AltLinkButton" OnClientClick="return confirm('Are you sure you want to delete all items?');"
                    runat="server" ID="buttonDeleteSelected" Text="Delete Selected" OnClick="ButtonDeleteSelected_Click" />
            </div>
            <div class="grid-viewer grid_19 clearfix">
                <asp:Literal EnableViewState="false" runat="server" ID="ltlMessage"></asp:Literal>
                <asp:GridView ID="gridViewSuppliers" runat="server" SkinID="GridView" DataSourceID="odsSupplierListing"
                    ClientIDMode="Static" DataKeyNames="SupplierId">
                    <Columns>
                        <asp:BoundField DataField="Name" HeaderText="Name" ReadOnly="True" SortExpression="Name" />
                        <asp:BoundField DataField="Address" HeaderText="Address" ReadOnly="True" SortExpression="Address" />
                        <asp:BoundField DataField="Phone" HeaderText="Phone" ReadOnly="True" SortExpression="Phone" />
                        <asp:BoundField DataField="Email" HeaderText="Email" ReadOnly="True" SortExpression="Email" />
                        <asp:BoundField DataField="Zip" HeaderText="Zip" ReadOnly="True" SortExpression="Zip" />
                        <asp:HyperLinkField Text="View" ControlStyle-CssClass="button small green" DataNavigateUrlFields="SupplierId"
                            DataNavigateUrlFormatString="~\view-supplier.aspx?supplierId={0}" HeaderText="View Supplier" />
                        <asp:HyperLinkField Text="Edit" ControlStyle-CssClass="button small orange" DataNavigateUrlFields="SupplierId"
                            DataNavigateUrlFormatString="~\add-supplier.aspx?supplierId={0}" HeaderText="Edit Supplier" />
                        <asp:HyperLinkField Text="Show Empoloyees" ControlStyle-CssClass="button small blue show-emp"
                            DataNavigateUrlFields="SupplierId" DataNavigateUrlFormatString="~\view-employees.aspx?supplierId={0}" />
                        <asp:TemplateField>
                            <ItemTemplate>
                                <asp:CheckBox runat="server" ID="chkEmployeeSelector" />
                            </ItemTemplate>
                            <HeaderTemplate>
                                <asp:CheckBox runat="server" ID="chkSelectAll" ClientIDMode="Static" onclick="SelectAll('gridViewSuppliers','chkSelectAll')" />
                            </HeaderTemplate>
                        </asp:TemplateField>
                    </Columns>
                </asp:GridView>
            </div>
            <div class="clearfix">
                <asp:ObjectDataSource ID="odsSupplierListing" runat="server" TypeName="Eisk.BusinessLogicLayer.SupplierBLL"
                    SelectMethod="GetSupplierByReportsToPaged" SelectCountMethod="GetTotalCountForAllSupplierByReportsTo"
                    SortParameterName="orderby" MaximumRowsParameterName="maximumRows" StartRowIndexParameterName="startRowIndex"
                    EnablePaging="True">
                    <SelectParameters>
                        <asp:Parameter Name="orderBy" Type="String" />
                        <asp:Parameter Name="startRowIndex" Type="Int32" />
                        <asp:Parameter Name="maximumRows" Type="Int32" />
                    </SelectParameters>
                </asp:ObjectDataSource>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
